const str1 = `jQuery1102011339532406238861_1647157779362({"q":"f","p":false,"g":[{"type":"sug","sa":"s_1","q":"伏天氏"},{"type":"sug","sa":"s_2","q":"facebook"},{"type":"sug","sa":"s_3","q":"翻译"},{"type":"sug","sa":"s_4","q":"福彩3D开奖结果"},{"type":"sug","sa":"s_5","q":"fog电竞"},{"type":"sug","sa":"s_6","q":"flag是什么意思"},{"type":"sug","sa":"s_7","q":"flag"},{"type":"sug","sa":"s_8","q":"fun"},{"type":"sug","sa":"s_9","q":"favourite"},{"type":"sug","sa":"s_10","q":"福利彩票开彩票双色球结果"}],"slid":"91156848996082","queryid":"0x6052e81b9a6ef2"})`;

const url = "https://www.baidu.com?cb=jQuery1102011339532406238861_1647157779362";
const test = (api, data) => {
	const r = new RegExp(/(\(.+)\)/);
	const result = eval(data.match(r).shift());
	return result["g"];
};

console.log(test(url, str1));
